package com.cap.bts.crmdp.dealer.mars.constants;

import java.util.ArrayList;
import java.util.List;

import org.apache.commons.lang3.StringUtils;

public final class MARSConstants {
	
	public static final List<String> MARS_SESSSION_ID_LIST =  new ArrayList<String>();

    /**
     * 套餐使用明细访问URL
     */
    public static final String MARS_PACKAE_USE_DETAIL_URL = "/crmdp/dealer/report/showMemberPackagesReportForMarsAll";
    
    public static final String MARS_PACKAE_USE_DETAIL_FOR_ALL_DEALER_URL = "/crmdp/dealer/report/showMemberPackagesForAllDealerReportForMars";

    /**
     * 卖卡url
     */
    public static final String MARS_SELL_PACKAGE_URL = "/MARS/toMemberPurchaseMars";
    
    /**
     * 激活url
     */
    public static final String MARS_ACTIVATION_URL = "/MARS/toMemberActivationMars";
    /**
     * 用卡url
     */
    public static final String MARS_REDEMPTION_URL = "/MARS/showMemberPackageListMars";
    
    //报表
    public static final String MARS_REPORT_URL = "/MARS/reports";
    
    //卡片接收
    public static final String MARS_RECEIVE_URL = "/crmdp/dealer/logistic/toQueryLogisitcReceivePage";
    
    //卡片接收和门店套餐选择导航
    public static final String MARS_RECEIVE_AND_SELECT_PACKAGE = "/MARS/receiveAndSelectPackage";
    
    public static final String MARS_SMS_URL = "/crmdp/dealer/remind/toRemind";
    
    public static final String MARS_COUPONREDEMPT_URL = "/MARS/coupon";
    
    private static String webRootURL = "/crm";

    // 返回结果
    // 1:表示同步成功；
    public static final String RESULT_STATUS_CODE_SUCCESS = "1";

    // 返回结果
    // 0:表示操作失败
    public static final String RESULT_STATUS_CODE_FAIL = "0";

    // CONSUME
    public static final String TRANS_TYPE_CONSUME = "CONSUME";

    // PREPAY
    public static final String TRANS_TYPE_PREPAY = "PREPAY";

    // 是否需要激活
    // 0:否
    public static final String IS_NEED_ACTIVATION_NO = "0";

    // 是否需要激活
    // 1:是
    public static final String IS_NEED_ACTIVATION_YES = "1";

    public static final List<String> MARS_URL = new ArrayList<String>();
	
	static{
		MARS_URL.add(webRootURL + "/MARS");
		MARS_URL.add(webRootURL + MARS_PACKAE_USE_DETAIL_URL);
		MARS_URL.add(webRootURL + MARS_SELL_PACKAGE_URL);
		MARS_URL.add(webRootURL + MARS_ACTIVATION_URL);
		MARS_URL.add(webRootURL + MARS_REDEMPTION_URL);
		MARS_URL.add(webRootURL + MARS_PACKAE_USE_DETAIL_FOR_ALL_DEALER_URL);
		MARS_URL.add(webRootURL + MARS_RECEIVE_URL);
		MARS_URL.add(webRootURL + MARS_REPORT_URL);
		MARS_URL.add(webRootURL + MARS_SMS_URL);
		MARS_URL.add(webRootURL + MARS_COUPONREDEMPT_URL);
		
//		MARS_URL.add(webRootURL + "/crmdp/dealer/purchase/purchaseMars")
//		MARS_URL.add(webRootURL + "/crmdp/dealer/purchase/getPackageInfoMars")
//		MARS_URL.add(webRootURL + "/crmdp/dealer/purchase/purchaseMars")
//		MARS_URL.add(webRootURL + "/crmdp/dealer/purchase/checkMemberPackageInfoExsit")
//		MARS_URL.add(webRootURL + "/logMars")
//		MARS_URL.add(webRootURL + "/logMars/data")
//		MARS_URL.add(webRootURL + "/MARS/toMemberActivationMars")
//		MARS_URL.add(webRootURL + "/MARS/toSaveMemberActivationMars")
//		MARS_URL.add(webRootURL + "/MARS/toSaveMemberActivationListMars")
//		MARS_URL.add(webRootURL + "/crmdp/dealer/activation/isPackageNumberExist")
//		MARS_URL.add(webRootURL + "/crmdp/dealer/activation/toPurchaseDetailInfo")
//		MARS_URL.add(webRootURL + "/crmdp/dealer/redemption/showMemberPackageListMars")

        MARS_URL.add(webRootURL + "/logMars");
        
        MARS_URL.add(webRootURL + "/logMars/data");
        //购买
        MARS_URL.add(webRootURL + "/MARS/purchaseMars");
        //购买-获取库存信息
        MARS_URL.add(webRootURL + "/MARS/getPackageInfoMars");
        //购买-卡号检查
        MARS_URL.add(webRootURL + "/MARS/checkMemberPackageInfoExsitMars");
        //激活页面（事前和事后）
        MARS_URL.add(webRootURL + "/MARS/toMemberActivationMars");
        //激活-卡号检查
        MARS_URL.add(webRootURL + "/MARS/isPackageNumberExist");
        //激活-卡号使用明细
        MARS_URL.add(webRootURL + "/MARS/toPurchaseDetailInfo");
        //事后激活
        MARS_URL.add(webRootURL + "/MARS/toSaveMemberActivationMars");
        //当场激活
        MARS_URL.add(webRootURL + "/MARS/toSaveMemberActivationListMars");
        //使用页面
        MARS_URL.add(webRootURL + "/MARS/showMemberPackageListMars");
        //使用套餐项目
        MARS_URL.add(webRootURL + "/MARS/usePackageItem");
        //使用项目类型选择
        MARS_URL.add(webRootURL + "/MARS/toWecareItemTypeInfoList");
        //卡片接收
        MARS_URL.add(webRootURL + "/crmdp/dealer/logistic/toReceiveLogisitcPage");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/logistic/toQueryLogisitcReceivePageForMars");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/meal/savePackageSelect");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/meal/toSelectPackagePage");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/meal/toSelectPackagePageForMars");
        
        MARS_URL.add(webRootURL + "/MARS/receiveAndSelectPackage");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toQueryInventoryPage");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toQueryMemberReport");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toQuerySalesReport");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toChartMemberPage");
       
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toChartInventoryPage");
       
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/backToMemberReportPage");
       
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/backToInventoryPage");

//        MARS_URL.add(webRootURL + "/crmdp/dealer/masterdata/toExportMemberAndPackageInfo");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/masterdata/checkMemberExist");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/masterdata/exportMember");
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/masterdata/exportPortfolio");
        //SMS推送
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/toRemindHistory");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/getRemindListSize");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/toRemind");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/toRemindForCarplate");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/toMsgPackageList");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/toMsgPackageHistoryList");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/sendRemindMsg");
        MARS_URL.add(webRootURL + "/crmdp/dealer/remind/comfirmMsgPackageItem");
        
        MARS_URL.add(webRootURL + "/logDataConversion");
        MARS_URL.add(webRootURL + "/logDataConversion/data");
        
        
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/loadCardNames");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/loadChartInventoryPage");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/loadChartInventoryMax");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/loadChartMemberPage");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toQuerySalesDetails");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/backToSalesReportPage");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/toExportSalesReport");
        
        
        MARS_URL.add(webRootURL + "/MARS/couponInfo");
        MARS_URL.add(webRootURL + "/MARS/coupon/ticket/");
        MARS_URL.add(webRootURL + "/MARS/toWecareItemTypeInfoList2");
        MARS_URL.add(webRootURL + "/crmdp/dealer/report/showMemberPackagesReportForMars");
        
    }

    private MARSConstants() {
    }

    public static boolean checkIsBaseMARSUrl(String url) {
    	int index = url.indexOf(";jsessionid=");
    	if(index > -1){
    		url = url.substring(0, index);
    	}
    	
    	if(StringUtils.equals(url, webRootURL + "/MARS")){
    		return true;
    	}

        return false;
    }
    
    public static boolean checkMARSUrl(String url) {
    	int index = url.indexOf(";jsessionid=");
    	if(index > -1){
    		url = url.substring(0, index);
    	}
    	
    	if(StringUtils.startsWith(url, webRootURL + "/bootstrap/fonts")){
    		return true;
    	}
    	
    	if(StringUtils.startsWith(url, webRootURL + "/MARS/")){
    		return true;
    	}
    	
    	return MARS_URL.contains(url);
    }

}
